var UserDataListModel = EventDispatcher.extend({

    _userDataList: null,

    constructor: function()
    {
    },

    getUserDataList: function()
    {
        return this._userDataList;
    },

    updateFromJson: function(userDataListJson)
    {
        var dataList = $.parseJSON(userDataListJson);
        this._userDataList = [];
        for (var i in dataList)
        {
            var data = dataList[i];
            var userData = new UserData();
            userData.id = data['id'];
            userData.name = data['name'];
            userData.sex = data['sex'];
            userData.notify = data['notify'];
            userData.comment = data['comment'];
            this._userDataList.push(userData);
        }
        this.dispatchEvent(UserDataListModel.event.UPDATED);
    },

    setUserDataList: function(userDataList)
    {
        this._userDataList = userDataList;
        this.dispatchEvent(UserDataListModel.event.UPDATED);
    }

}, {
    instance: null,

    getInstance: function()
    {
        if (!UserDataListModel.instance)
        {
            UserDataListModel.instance = new UserDataListModel();
        }
        return UserDataListModel.instance;
    },

    event:
    {
        UPDATED: 'updated'
    }
});
